import { observable, action } from 'mobx';
import { WeaTableNew, WeaForm } from 'comsMobx';
import { WeaTools } from 'ecCom';
import { Modal, message } from 'antd';
import { WeaLocaleProvider } from 'ecCom';

const getLabel = WeaLocaleProvider.getLabel;
export class ProductStore {
    @observable form = new WeaForm();
    @observable loading = false;
    @observable condition = [];

    @observable verified = false;
	@observable hasRight = false; // 权限

    @action
    initProductData=(params = {}) => {
      this.loading = true;
      WeaTools.callApi('/api/crm/contract/formProduct', 'GET', params).then((data) => {
        if (!data.hasright && typeof (data.hasright) !== 'undefined') {
          this.hasRight = false;
          this.verified = true;
        } else {
          this.hasRight = true;
          this.verified = true;
          this.condition = data.datas;
          this.form && !this.form.isFormInit && this.form.initFormFields(data.datas);
          this.loading = false;
        }
      });
    }
}
